home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Original Code / Pages and Transforms / RectangleProblem / RectangleProblem.cs next >
Encoding:
Text File  |  2001-01-15  |  782 b   |  29 lines

  1. //-----------------------------------------------
  2. // RectangleProblem.cs ⌐ 2001 by Charles Petzold
  3. //-----------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. class RectangleProblem: PrintableForm
  9. {
  10.      public new static void Main()
  11.      {
  12.           Application.Run(new RectangleProblem());
  13.      }
  14.      public RectangleProblem()
  15.      {
  16.           Text = "Rectangle Problem";
  17.      }
  18.      protected override void DoPage(Graphics grfx, Color clr, int cx, int cy)
  19.      {
  20.           Pen pen = new Pen(clr, 0.1f);
  21.  
  22.           grfx.PageUnit  = GraphicsUnit.Inch;
  23.           grfx.PageScale = 0.1f;
  24.  
  25.           grfx.DrawRectangle(pen,  0,  0, 10, 10);
  26.           grfx.DrawRectangle(pen, 10, 10, 10, 10);
  27.      }
  28. }
  29.